<template>
    <div>
        <div class="top">
            <span>LOGIN</span>
            <img src="@/assets/arrow_left.png" alt="" @click="handleBack">
        </div>
        <div class="main">
            <p class="title">欢迎回来！</p>
            <van-tabs type="card" style="margin: 40px 0;">
                <van-tab title="账号密码登录">
                    <div class="account">
                        <p>账号</p>
                        <input type="text" v-model="userinfo.username" placeholder="请输入用户名/手机号码/邮箱">
                    </div>
                    <div class="pwd">
                        <p>密码</p>
                        <input type="text" v-model="userinfo.password" placeholder="8-18位不含特殊字符的数字、字母组合">
                    </div>
                </van-tab>
                <van-tab title="短信验证登录">
                    <div class="account">
                        <p>手机号码</p>
                        <input type="text" placeholder="请输入手机号码">
                    </div>
                    <div class="email">
                        <p>验证码</p>
                        <input type="text" placeholder="请输入验证码">
                    </div>
                </van-tab>
            </van-tabs>
            <van-button type="primary" round size="small" 
            block color="#fa436a" @click="handleLogin">登录</van-button>
        </div>
    </div>
</template>
<script>
export default {
   data() {
      return {
        userinfo:{
            username:"admin",
            password:"12345678",
            loginway:0
        },
        show:false
      }
   },
   created(){
   },
   computed:{
   },
   methods:{
    handleBack(){
        this.$router.go(-1);
    },
    handleLogin(){
        if(this.userinfo.username && this.userinfo.password ){
            this.$store.dispatch("USER_LOGIN",this.userinfo);
            setTimeout(() => {
                if(this.$store.state.token){
                    this.$router.go(-1);
                }else{
                    this.$dialog.alert({title: '提示',message: '用户名或者密码错误'})
                }
            }, 1000);
        }else{
            this.$dialog.alert({title: '提示',message: '不能为空'})
        }
    }
   },
}
</script>
<style scoped>
    .top{
        width: 100%;
        height: 69px;
        position: relative;
    }
    .top span{
        font-size: 69px;
        color: #f8f8f8;
    }
    .top img{
        width: 30px;
        height: 30px;
        position: absolute;
        left: 15px;
        top: 15px;
        cursor: pointer;
    }
    .top::before{
        display: block;
        content: "";
        width: 200px;
        height: 40px;
        background: #b4f3e2;
        -webkit-transform: rotate(50deg);
        transform: rotate(50deg);
        border-radius: 0 50px 0 0;
        position: absolute;
        right: 88px;
        top: 45px;
    }
    .top::after{
        position: absolute;
        right: -20px;
        top: 34px;
        -webkit-transform: rotate(-50deg);
        transform: rotate(-50deg);
        border-radius: 50px 0 0 0 /* background: pink; */;
        display: block;
        content: "";
        width: 200px;
        height: 40px;
        background: #b4f3e2;
    }
    .main{
        width: 90%;
        height: 430px;
        margin: 20px auto;
    }
    .main .title{
        font-size: 25px;
        color: #555555;
        font-weight: 500;
        margin: 10px 0;
    }
    .account{
        width: 80%;
        height: 60px;
        margin: 10px auto;
        background-color: #f8f6fc;
        padding: 0 5%;
        overflow: hidden;
    }
    .account p{
        font-size: 13px;
        color: #606266;
        margin: 5px 0;
    }
    .account input{
        border: none;
        height: 22px;
        background-color: #f8f6fc;
        margin: 5px 0;
    }

    .pwd{
        width: 80%;
        height: 60px;
        margin: 10px auto;
        background-color: #f8f6fc;
        padding: 0 5%;
        overflow: hidden;
    }
    .pwd p{
        font-size: 13px;
        color: #606266;
        margin: 5px 0;
    }
    .pwd input{
        border: none;
        height: 22px;
        background-color: #f8f6fc;
        margin: 5px 0;
    }

    .email{
        width: 80%;
        height: 60px;
        margin: 10px auto;
        background-color: #f8f6fc;
        padding: 0 5%;
        overflow: hidden;
    }
    .email p{
        font-size: 13px;
        color: #606266;
        margin: 5px 0;
    }
    .email input{
        border: none;
        height: 22px;
        background-color: #f8f6fc;
        margin: 5px 0;
    }

</style>
